import { get, post } from '../utils/request'
// 内容模块需要单独设置内容类型
const headers = {
  'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
}
// 分类列表
export const categoryList = (params) => {
  // return contentGet('/admin/content/category/list', params)
  return get('/admin/content/category/list', params)
}
// 添加分类
export const categoryAdd = (data) => {
  return post('/admin/content/category/insert', data, { headers })
}
// 编辑分类
export const categoryEdit = (data) => {
  return post('/admin/content/category/update', data, { headers })
}
// 删除分类
export const categoryDel = (data) => {
  return post('/admin/content/category/delete', data)
}
// 分类详情
export const categoryDetail = (params) => {
  return get('/admin/content/category/get', params)
}
// 文章列表
export const contentArticleList = (params) => {
  return get('/admin/content/article/list', { ...params, source: 2 })
}
// 新增文章
export const contentArticleAdd = (data) => {
  return post(
    '/admin/content/article/insert',
    { ...data, source: 2 },
    { headers }
  )
}
// 编辑文章
export const contentArticleEdit = (data) => {
  return post(
    '/admin/content/article/update',
    { ...data, source: 2 },
    { headers }
  )
}
// 文章详情
export const contentArticleDetail = (params) => {
  return get('/admin/content/article/get', params)
}
// 删除文章
export const contentArticleDel = (data) => {
  return post('/admin/content/article/delete', data, { headers })
}
